-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ONNX Frontend instead of ONNX Reader #7031
Use ONNX Frontend instead of ONNX Reader #7031
Conversation
Co-authored-by: Tatiana Savina <[email protected]>
…o mbencer/LoadByModel
@@ -282,6 +270,19 @@ CNNNetwork details::ReadNetwork(const std::string& model, | |||
return reader->read(modelStream, exts); | |||
} | |||
} | |||
// Try to load with FrontEndManager | |||
// NOTE: weights argument is ignored | |||
static ngraph::frontend::FrontEndManager manager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use one instance of FrontEndManager
for core object?
Now you have 2 static instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -259,7 +247,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath, | |||
} | |||
if (inputModel) { | |||
auto ngFunc = FE->convert(inputModel); | |||
return CNNNetwork(ngFunc); | |||
return CNNNetwork(ngFunc, exts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a scenario
- add extension
- read an ONNX model
- serialize it to xml
- read the model again as xml
Passingexts
is needed. It is tested byCustomOpUser_ONNXImporter
unit test
@@ -49,3 +85,63 @@ std::shared_ptr<ngraph::Function> FrontEndONNX::decode(InputModel::Ptr model) co | |||
NGRAPH_CHECK(model_onnx != nullptr, "Invalid input model"); | |||
return model_onnx->decode(); | |||
} | |||
|
|||
std::string FrontEndONNX::get_name() const { | |||
return "onnx_experimental"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "experimental"? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, we can change it to "onnx", but onnx frontend is still skipped in mo.py
static ngraph::frontend::FrontEndManager* get_frontend_manager() { | ||
static ngraph::frontend::FrontEndManager manager; | ||
return &manager; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static ngraph::frontend::FrontEndManager* get_frontend_manager() { | |
static ngraph::frontend::FrontEndManager manager; | |
return &manager; | |
} | |
static ngraph::frontend::FrontEndManager& get_frontend_manager() { | |
static ngraph::frontend::FrontEndManager manager; | |
return manager; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline to resolve it separately
Please resolve comments in the separate PR |
* added get_name * add support to supported_impl * remove debug code * review remarks * changed name to onnx_experimental * fixed test * revert onnx_experimental name * integrate reader and fe api * add unit tests * removed prototxt from model_validator * reader refactor * add supress * Update inference-engine/src/readers/onnx_reader/ie_onnx_reader.cpp Co-authored-by: Tomasz Dołbniak <[email protected]> * fix segfaults * removed onnx reader * handle istringstream * wstring support * removed saving path * styles applied * changed name to onnx experimental * Apply suggestions from code review Co-authored-by: Tatiana Savina <[email protected]> * skip onnx_experimental frontend in mo.py * add support of wstring paths * fix wstring ctor of InputModelONNX * added NGRAPH_SUPPRESS * make one instance of manager * change onnx_experimental name to onnx * creation frontend manager refactor Co-authored-by: Tomasz Dołbniak <[email protected]> Co-authored-by: Tatiana Savina <[email protected]>
* added get_name * add support to supported_impl * remove debug code * review remarks * changed name to onnx_experimental * fixed test * revert onnx_experimental name * integrate reader and fe api * add unit tests * removed prototxt from model_validator * reader refactor * add supress * Update inference-engine/src/readers/onnx_reader/ie_onnx_reader.cpp Co-authored-by: Tomasz Dołbniak <[email protected]> * fix segfaults * removed onnx reader * handle istringstream * wstring support * removed saving path * styles applied * changed name to onnx experimental * Apply suggestions from code review Co-authored-by: Tatiana Savina <[email protected]> * skip onnx_experimental frontend in mo.py * add support of wstring paths * fix wstring ctor of InputModelONNX * added NGRAPH_SUPPRESS * make one instance of manager * change onnx_experimental name to onnx * creation frontend manager refactor Co-authored-by: Tomasz Dołbniak <[email protected]> Co-authored-by: Tatiana Savina <[email protected]>
Ticket: 62297, 62730
load_by_model
for ONNX FE (from file and from stream + passing path needed for onnx external data feature)